/*
 * @Author: Otway
 * @Date: 2019-01-09 11:16:08
 * @LastEditors: Otway
 * @LastEditTime: 2019-08-30 18:50:09
 * @copyright: h-visions
 */
import React, { PureComponent } from 'react';
import { BasicPagination, isInvalidObject, compareNum, TableCustomize, openSuccessModal, openModalMessage, compareString } from '../../../components/TableCustomize'
import * as CommissioningManagementService from '../../../axios/CommissioningManagement'
import {
    Row,
    Col,
    Form,
    Select,
    Layout,
    List,
    Button,
    Pagination,
    Radio,
    Input,
    Alert,
    Spin, Card
} from 'antd';
const FormItem = Form.Item;
const { Header, Footer, Sider, Content } = Layout;
const { Option } = Select

class ReceiveComponentItem extends PureComponent {

    state = {
        columns: [
            {
                title: '序号',
                dataIndex: 'dataIndex',
                width: 100,
                render: (text, record, index) => <span>{(this.state.pageNum - 1) * (this.state.pageSize) + index + 1}</span>
            },
            {
                title: '物料编码',
                dataIndex: 'batchNo1',
                width: 100,
                sorter: (a, b) => compareString(a.batchNo1, b.batchNo1)
            },
            {
                title: '图号',
                dataIndex: 'batchNo',
                width: 100,
                sorter: (a, b) => compareString(a.batchNo, b.batchNo)
            },

            {
                title: '装配组别',
                width: 100,
                dataIndex: 'model',
                sorter: (a, b) => compareString(a.model, b.model),
                // editable: true
            },
            {
                title: '物料名称',
                width: 100,
                // allowEllipsis: true,
                dataIndex: 'department1',
                sorter: (a, b) => compareString(a.department1, b.department1)
            },
            {
                title: '物料规格',
                width: 100,
                // allowEllipsis: true,
                dataIndex: 'department',
                sorter: (a, b) => compareString(a.department, b.department)
            },
            {
                title: '仓库',
                width: 100,
                // allowEllipsis: true,
                dataIndex: 'assembleProcess',
                sorter: (a, b) => compareString(a.assembleProcess, b.assembleProcess)
            },
            {
                title: '发放数量',
                width: 100,
                // allowEllipsis: true,
                dataIndex: 'testMachineProcess',
                sorter: (a, b) => compareNum(a.testMachineProcess, b.testMachineProcess)
            },
            {
                title: '需求数量',
                width: 100,
                // allowEllipsis: true,
                dataIndex: 'qualityCheckProcess',
                sorter: (a, b) => compareNum(a.qualityCheckProcess, b.qualityCheckProcess)
            },
        ],
        loading: false,
        dataSource: [],
    }
    render() {
        const { form: { getFieldDecorator, getFieldValue }, formData, spanStyle } = this.props;
        const {columns, dataSource, loading} = this.state
        console.log(formData, 'formData')

        return (
            <div>
                <Row>
                    <Card
                        type="inner"
                        title={<div>
                            <Row gutter={24} style={{ fontSize: 13 }}>
                                <Col span={5}>批号： {'C40000/01'}</Col>
                                <Col span={5}>机型： {'DCC600'}</Col>
                                <Col span={5}>项数： 共<span style={spanStyle}> {5} </span>项</Col>
                                <Col span={9}>领料单： {'LLDJ20210111-PJ01'}</Col>
                                <Col span={5}>部门： {'大机总装'}</Col>
                                <Col span={5}>班组： {'总装1组'}</Col>
                                <Col span={5}>机位： {'1号机位'}</Col>
                            </Row>
                        </div>} extra={''} style={{ width: '100%' }}>
                        <TableCustomize
                            columns={columns}
                            rowKey={(record) => record.batchNo}
                            dataSource={dataSource}
                            pagination={false}
                            loading={loading}
                            allowDrafting={true} />
                    </Card>
                </Row>
                <Row>
                </Row>
            </div>
        );
    }
}

export default Form.create()(ReceiveComponentItem);
